/* 超链接 */


.link() {
    /* 默认样式 */
    margin: 0;
    padding: 0;
    border-bottom-color: inherit;
    color: var(--b3-protyle-inline-link-color);

    .link-icon(url(/appearance/themes/Dark+/icon/unknown.svg));
}

.link-icon(@url) {
    &::before {
        /* 超链接前标志 */
        content: "";
        display: inline-block;
        position: relative;

        background-image: @url;
        background-size: 0.875em auto;
        background-repeat: no-repeat;
        background-position: center;

        width: 0.875em;
        height: 1em;
        margin: 0.125em 0.125em -0.125em 0;
        padding: 0;
    }
}

.link-siyuan() {
    /* 思源内部的超链接特化 */
    color: var(--custom-span-siyuan-link-color);

    &[data-href *="focus=1"],
    &[href *="focus=1"] {
        &::before {
            /* 思源聚焦超链接特化 */
            outline: 1px solid var(--custom-span-siyuan-link-color);
        }
    }
}

#sidebar [data-type="sidebar-outline"],
.sy__outline,
.protyle-wysiwyg {
    [data-node-id] {

        span[data-type~=a],
        span[data-type~=url] {
            .link();

            &[data-href ^="siyuan:"] {
                .link-siyuan();
            }

            a {
                &::before {
                    display: none;
                }
            }
        }
    }
}

#sidebar [data-type="sidebar-outline"],
.sy__outline {
    [data-node-id] {
        span[data-type~=a] {
            &:hover {
                border-bottom: 1px solid;
            }
        }
    }
}

.protyle-wysiwyg,
.b3-typography {
    a {
        .link();

        &[href ^="siyuan:"] {
            .link-siyuan();
        }

        &[href^="pdf-outline:"] {
            &::before {
                display: none;
            }
        }
    }
}
